
using QdbUnit;
using QdbUnit.Extensions;
using Qdb;
using Qdb.Query;
using Qdb.Tests.Common.Assorted;

namespace Qdb.Tests.Common.Assorted
{
	public class SimplestPossibleTestCase : AbstractQdbTestCase
	{
		public static void Main(string[] args)
		{
			new SimplestPossibleTestCase().RunSolo();
		}

		protected override void Store()
		{
			Db().Store(new SimplestPossibleTestCase.Item("one"));
		}

		public virtual void Test()
		{
			IQuery q = Db().Query();
			q.Constrain(typeof(SimplestPossibleTestCase.Item));
			q.Descend("name").Constrain("one");
			IObjectSet objectSet = q.Execute();
			SimplestPossibleTestCase.Item item = (SimplestPossibleTestCase.Item)objectSet.Next
				();
			Assert.IsNotNull(item);
			Assert.AreEqual("one", item.GetName());
		}

		public class Item
		{
			public string name;

			public Item()
			{
			}

			public Item(string name_)
			{
				this.name = name_;
			}

			public virtual string GetName()
			{
				return name;
			}
		}
	}
}
